home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / PowerPlant / CDragAndDrop / CDragAndDropFSSpec.cp < prev    next >
Encoding:
Text File  |  1995-02-09  |  1.6 KB  |  64 lines  |  [TEXT/CWIE]

  1. // ============================================================================
  2. //    CDragAndDropFSSpec.cp
  3. //    ©1995 J. Rodden, DD/MF & Associates. All rights reserved
  4. // ============================================================================
  5.  
  6. #include <CDragAndDropFSSpec.h>
  7.  
  8. #include <Finder.h>
  9.  
  10. #include <LPane.h>
  11.  
  12. // ============================================================================
  13.  
  14. CDragAndDropFSSpec::CDragAndDropFSSpec(WindowPtr inMacWindow, LPane *inPane)
  15.         : CDragAndDrop(inMacWindow, inPane)
  16. {
  17.     mFlavorAccepted = flavorTypeHFS;
  18. }
  19.  
  20.  
  21. // ============================================================================
  22.  
  23. void
  24. CDragAndDropFSSpec::RetrieveDragData(
  25.     DragReference    inDragRef,
  26.     ItemReference    inItemRef,
  27.     Size            inDataSize,
  28.     Boolean            inCopyData, 
  29.     Boolean            inFromFinder,
  30.     Rect&            inItemBounds)
  31. {
  32.     
  33.     HFSFlavor    theFlavorData;    // Where we will put the data.
  34.     Size        theDataSize = inDataSize;
  35.  
  36.     if ( inDataSize <= mFlavorSize ) {
  37.         ::GetFlavorData(inDragRef, inItemRef, mFlavorTypeRcve, 
  38.                         (Ptr) &theFlavorData, &theDataSize, 0L);
  39.                             
  40.         //    resolve alias files
  41.         if( theFlavorData.fdFlags & kIsAlias ) {
  42.             Boolean    targetIsFolder, wasAliased;
  43.             ::ResolveAliasFile( &theFlavorData.fileSpec, true, &targetIsFolder, &wasAliased);
  44.         }
  45.         
  46.         CopyOrMoveData( &theFlavorData, inDataSize, inCopyData, inFromFinder, inItemBounds);
  47.     }
  48. }
  49.  
  50.  
  51. // ============================================================================
  52.  
  53. void
  54. CDragAndDropFSSpec::CopyOrMoveData(
  55.     void*    theFlavorData,
  56.     Size    inDataSize,
  57.     Boolean    inCopyData,
  58.     Boolean    inFromFinder,
  59.     Rect&    inItemBounds)
  60. {
  61.     mPane->SetDescriptor(((HFSFlavor*) theFlavorData)->fileSpec.name);
  62. }
  63.  
  64.